<!DOCTYPE html>
<html>

<head>
	<meta charset="utf-8">
	<title>角色新增</title>
	<link rel="stylesheet" type="text/css" href="/admin/css/bootstrap.min.css"/>
	<link rel="stylesheet" type="text/css" href="/admin/css/bootstrap-table.min.css"/>
	<link rel="stylesheet" type="text/css" href="/admin/css/style.min.css" />
	<link rel="stylesheet" type="text/css" href="/admin/layui/css/layui.css">

	<script src="/admin/js/jquery-3.3.1.min.js"></script>
	<script src="/admin/js/bootstrap.js"></script>
	<script src="/admin/layui/layui.js" charset="utf-8"></script>
	<script src="/admin/js/api.js" charset="utf-8"></script>
	<script src="/admin/js/base.js" charset="utf-8"></script>
	<script src="/admin/js/common.js"></script>

</head>
<body>
<div>
	<!-- Tab panes -->
	<div class="tab-content form-content">
		<div>
			<div class="rigthContent">
				<form class="layui-form layui-form-content" lay-filter="add_form" action="">
					<div class="tab-content form-content">
						<div class="row tab-pane active" role="tabpanel" id="form-tab1">
							<div class="col-sm-12">
								<div class="ibox float-e-margins">
									<div class="" >
                                        <div class="layui-form-item">
                                            <div class="layui-inline width-100">
												<label class="layui-form-label">角色名称：</label>
												<div class="layui-input-block">
													<input type="name" id="name" name="name" lay-verify="required" autocomplete="off" class="layui-input" placeholder="请输入角色名称">
												</div>
                                            </div>
                                        </div>
                                        <div class="layui-form-item">
                                            <div class="layui-inline width-100">
												<label class="layui-form-label">角色描述：</label>
												<div class="layui-input-block">
													<textarea id="remark" name="remark" rows="3" class="layui-textarea" placeholder="请输入角色描述"></textarea>
												</div>
                                            </div>
                                        </div>
									</div>
								</div>
							</div>
						</div>
					</div>
					<div class="layui-form-submit">
						<button id="save" type="button" class="layui-btn" lay-submit="" lay-filter="save" id="save">提交</button>
						<a class="layui-btn handle_back" onclick="toClose()">取消</a>
					</div>
				</form>
			</div>
		</div>
	</div>
</div>
<script>

	var id = getParam("id");

	layuiReady (function() {

		if (id) {
			dataView(id);
		}
		_loadingClose();

		layform.on('submit(save)', function(data) {
			data = data.field;
			data.id = id;
			Layui.confirm("确定提交吗？", '', function(layer, index) {
				noSubmit();
				This.jqueryAjax(Api.admin.base.role.addBaseRole, data, "json", function(data) {
					if(data.status == 1) {
						closeFlushParent(parent);
						parent.parent_receive(data.message);
					} else {
						reSubmit();
						layerMessage(data.message, 2);
					}
				});
			});
		});
	});

	function dataView (id) {
		This.jqueryAjax(Api.admin.base.role.getBaseRoleById, {id: id}, "json", function (data) {
			if (data.status == 1) {
				valData(data.object);
			}
		});
	}

    //------------------------------------------详情回填数据-结束-------------------------------------------
</script>

</body>

</html>